﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SageKing.Core.Extensions;

public static class DoubleExts
{
    /// <summary>
    /// 转为百分比字符串
    /// $"{d*100}%"
    /// </summary>
    /// <param name="d"></param>
    /// <param name="precision"></param>
    /// <returns></returns>
    public static string ToP(this double d)
    {
        return $"{d * 100}%";
    }

    /// <summary>
    /// 转为百分比字符串
    /// 反转
    /// $"{ (1-d) * 100}%"
    /// </summary>
    /// <param name="d"></param>
    /// <returns></returns>
    public static string ToUnP(this double d)
    {
        return $"{(1 - d) * 100}%";
    }
}
